package com.slz3.business.module.configManagement.conActivityForecast.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class ConActivityForecastFactory {

    /**
     * 初始化基础属性值
     */
    public static ConActivityForecast initBaseFields(ConActivityForecast conActivityForecast) {
        if (conActivityForecast.getUuid() == null) {
            conActivityForecast.setUuid(UUIDUtils.generateUUID());
            conActivityForecast.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(conActivityForecast.getSerAudit())) {
                conActivityForecast.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(conActivityForecast.getSerUsing())) {
                conActivityForecast.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            conActivityForecast.setLastModifyTime(LocalDateTime.now());
        }
        return conActivityForecast;
    }

    /**
     * 初始化基础属性值
     */
    public static ConActivityForecast initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static ConActivityForecast newTemStyle() {
        return new ConActivityForecast();
    }

}
